﻿
<link rel="stylesheet" type="text/css" href='@Url.Content("~/Scripts/tab/css/easyui.css")'/>
<link rel="stylesheet" type="text/css" href='@Url.Content("~/Scripts/tab/css/icon.css")'/>
<script type="text/javascript" src='@Url.Content("~/Scripts/tab/js/jquery.easyui.min.js")'></script>
 

@model Webcar.Entitys.SEND_MSG_HEAD


 

@using (Html.BeginForm("Edit", "Mail", Html.ViewContext.RouteData.Values, FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.HiddenFor(a => a.MSG_XH)
    @Html.AntiForgeryToken()
    <div id="tt" class="easyui-tabs" style="width:800px;height:500px;">
        <div id="edit-car" title="公事内容" style="padding:20px;">
    

        <table class="edit-table">
            <tr>
                <td style="text-align: right">发送人：</td>
                <td >@CurrentUser.GetLoginUserName()</td>
            </tr>
            <tr>
                <td style="width: 80px; text-align: right;">发送时间：</td>
                <td>@DateTime.Now.ToDefaultDateTimeString()</td>
            </tr>

            <tr>
                <td style="text-align: right">文号：</td>
                <td >@Model.wh</td>
            </tr>

            <tr>
                <td style="text-align: right">*内容：</td>
                <td colspan="3">@Html.TextAreaFor(a=>a.NOTE,15,30,new{style="width:100%"})</td>
            </tr>
            <tr>
                <td style="text-align: right">附件：</td>
                <td colspan="3">支持格式:rar|zip|doc|xls|ppt|docx </td>
            </tr>
            <tr>
                <td style="text-align: right">选择附件：</td>
                <td colspan="3"><input type="file" id="fileImage" name="fileImage" /> </td>
            </tr>
        </table>
        
        

        </div>

        <div title="发送人员" style="overflow:auto;">
            <hr />
            <table>
                <tr>
                    <td>@Html.DevExpress().Button(settings => {
                   settings.Name = "btnSelectCheckBoxList";
                   settings.Text = "全选";
                   settings.Width = 80;
                   settings.ClientSideEvents.Click = "function(s, e) { chkAllUsers.SelectAll(); }";
               }).GetHtml()</td>
                    <td>@Html.DevExpress().Button(settings => {
                   settings.Name = "btnUnSelectCheckBoxList";
                   settings.Text = "全不选";
                   settings.Width = 80;
                   settings.ClientSideEvents.Click = "function(s, e) { chkAllUsers.UnselectAll(); }";
               }).GetHtml()</td>
                </tr>
            </table>
            
            
            <hr />
            @(Html.DevExpress().CheckBoxList(settings => {
                settings.Name = "chkAllUsers";
                settings.Properties.ValueField = "account";
                settings.Properties.TextField = "name";
                settings.Properties.ValueType = typeof(string);
                settings.Properties.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Table;
                settings.Properties.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal;
                settings.Properties.RepeatColumns = 4;
                settings.Properties.ItemSpacing = Unit.Pixel(5);
                
                settings.PreRender = (sender, e) => {
                    //ASPxCheckBoxList cbl = (ASPxCheckBoxList)sender;
                    //foreach(ListEditItem item in cbl.Items) {
                    //    item.Selected = ViewBag.Students.Contains((string)item.Value);
                    //}
                };
            })
            .BindList(ViewBag.AllUsers)
            .GetHtml()
        )

            
        </div>
    </div>
    
    
    <div class="validation-errors">@ViewBag.ErrorMessage</div>
        
    
    
    <table style="width:800px">
        <tr>
            <td style="width:650px;"></td>
            <td>
                @Html.DevExpress().Button(settings =>
                {
                    settings.Name = "Button1";
                    settings.Text = "保存";
                    settings.UseSubmitBehavior = false;
                    settings.Width = 70;
                    settings.ControlStyle.CssClass = "button1";
                    settings.ClientSideEvents.Click = "function(s, e){ commit_data();}";
                }).GetHtml()
                

            </td>
            <td>
                @Html.DevExpress().Button(settings =>
                {
                    settings.ControlStyle.CssClass = "button2";
                    settings.Name = "Button2";
                    settings.Text = "取消";
                    settings.Width = 70;
                    settings.ClientSideEvents.Click = "function(s, e){history.back(); }";
                }).GetHtml()
            </td>
        </tr>

    </table>
    <script type="text/javascript">
        function commit_data() {
            if ($("#NOTE").val() == null || $("#NOTE").val() == "") {
                alert("请输入内容。");
                return;
            }

            var selected_user = chkAllUsers.GetSelectedValues();
            
            if (selected_user == null || selected_user == "") {
                alert("请选择要发送的人员。");
                return;
            }
            var allow_ext = "rar|zip|doc|xls|ppt|docx|";
            if (!check_file("fileImage", allow_ext, 4096)) return;
            document.forms[0].submit();
        };
    </script>
}     


